package com.douziit.meilianoa.base.enums;

/**
 * @author lh <br>
 * date: 2019/12/19  <br>
 * Description: 系统初始化角色<br>
 */
public enum RoleEnum {
    /**
     * 超管
     */
    SUPER_ADMIN(0, "超管"),
    /**
     * 管理员
     */
    ADMIN(1, "管理员"),
    /**
     * 财务
     */
    CAIWU(2, "财务"),
    /**
     * 督导
     */
    DUDAO(3, "督导");;

    private Integer val;
    private String desc;

    public Integer getVal() {
        return val;
    }

    public String getDesc() {
        return desc;
    }

    RoleEnum(Integer val, String desc) {
        this.val = val;
        this.desc = desc;
    }

    /**
     * 资源类型
     */
    public enum ResTypes{
        MENU(1, "菜单"),
        INTERFACE(2, "接口");

        private Integer val;

        private String desc;

        ResTypes(Integer val, String desc) {
            this.val = val;
            this.desc = desc;
        }

        public Integer getVal() {
            return val;
        }

        public String getDesc() {
            return desc;
        }
    }

    /**
     * 工作人员状态码类型
     */
    public enum UserStatus{
        DISABLE(1, "停用"),
        ENABLE(0, "启用");

        private Integer val;

        private String desc;

        UserStatus(Integer val, String desc) {
            this.val = val;
            this.desc = desc;
        }

        public Integer getVal() {
            return val;
        }

        public String getDesc() {
            return desc;
        }
    }

    /**
     * 判断枚举类中是否包含某个值
     * @param val
     * @return
     */
    public static boolean contains(Integer val){
        for (RoleEnum c : RoleEnum.values()) {
            if (c.val.equals(val)) {
                return true;
            }
        }
        return false;
    }
}
